<?php
    use services\models\OrderInfoDetail;
    $conId = Yii::$app->controller->id;
?>
<?php if(count($orderInfo) > 0) :?>
    <!--订单列表循环 Start-->
    <?php foreach($orderInfo as $key=>$val):?>
        <li class="box-sizing">
            <p class="order-num">订单号：<?=$val['order_sn']?>
                <?php if(OrderInfoDetail::$STATUS_ORDER_CREATED==$val['status']) :?>
                    <?php if(strtotime($val['create_time'])- strtotime("-12 hours")>0) :?>
                        <?php if($val['pay_status']==OrderInfoDetail::$PAY_STATUS_WAIT) :?>
                            <span>待付款</span>
                        <?php elseif ($val['pay_status'] == OrderInfoDetail::$PAY_STATUS_CANCEL): ?>
                            <span>已取消</span>
                        <?php endif;?>
                    <?php else :?>
                        <span>已取消</span>
                    <?php endif;?>
                <?php elseif (OrderInfoDetail::$STATUS_PAYED == $val['status']): ?>
                    <span>待发货</span>
                <?php elseif (OrderInfoDetail::$STATUS_CONFIRM == $val['status']): ?>
                    <span>待收货</span>
                <?php elseif (OrderInfoDetail::$STATUS_TO_SHIP == $val['status']): ?>
                    <span>待收货</span>
                <?php elseif (OrderInfoDetail::$STATUS_SIGN_IN == $val['status']): ?>
                    <span>待收货</span>
                <?php elseif (OrderInfoDetail::$STATUS_ORDER_OK == $val['status']): ?>
                    <?php if ($val['orderGoods']['flg'] == OrderInfoDetail::$STATUS_COMMENT_NO): ?>
                        <span>待评论</span>
                    <?php else:?>
                        <span>已完成</span>
                    <?php endif; ?>

                <?php elseif (OrderInfoDetail::$STATUS_ORDER_CANCEL == $val['status']): ?>
                    <span>已取消</span>
                <?php endif ;?>
            </p>
            <div class="img-list">
                <!--订单图片循环 Start-->
                <?php if($val['orderGoods']['data']) :?>
                    <?php foreach ($val['orderGoods']['data'] as $k=>$v) :?>
                        <?php if($k < 4):?>
                        <div class="box-sizing">
                        <a href="<?=Yii::$app->urlManager->createUrl(["{$conId}/deatilwap",'order_info_id'=>$val['order_info_id']])?>">
                            <img src="<?php if($v['goodPic']['pic'] !='') :?><?=Yii::$app->params['goods_image_url'].str_replace('./upload', 'upload', $v['goodPic']['pic'])?><?php endif;?>" />
                         </a>
                        </div>
                        <?php endif;?>
                    <?php endforeach ;?>
                <?php endif ;?>
                
           </div>
            <p class="total-price">
                合计：<span>
                    <?php if($val['order_amount'] !=0):?>￥<?=Yii::$app->formatter->asDecimal($val['order_amount'],2)?><?php endif;?>
                    <?php if($val['order_amount'] !=0 && $val['try_coin'] !=0):?>+<?php endif;?>
                    <?php if($val['try_coin'] !=0):?><?= $val['try_coin'] ?>试豆<?php endif;?>
                </span>
                <!--删除查看更多-->
            </p>

            <?php if ($val['status'] == OrderInfoDetail::$STATUS_ORDER_CREATED): ?>
                <?php if($val['pay_status'] ==OrderInfoDetail::$PAY_STATUS_WAIT && (strtotime($val['create_time'])- strtotime("-12 hours"))>0):?>
                    <div class="bottom">
                        <p class="countdown countdown_<?=$countdown?>" data="<?php echo strtotime($val['create_time'])- strtotime("-12 hours");?>">剩余：<span></span></p><!--未支付倒计时-->
                        <!--订单操作按钮 Start-->
                        <a class="btn" href="<?=Yii::$app->urlManager->createUrl(["order/success",'order_info_id'=>$val['order_info_id']]);?>">立即付款</a>

                        <!--订单操作按钮 End-->
                    </div>
                <?php endif ;?>

            <?php elseif (in_array($val['status'],OrderInfoDetail::$STATUS_IN_KEY)): ?>
                <div class="bottom">
                    <a class="btn" href="<?=Yii::$app->urlManager->createUrl(["{$conId}/logic",'order_info_id'=>$val['order_info_id']])?>">查看物流</a>
                    <a class="btn getGoods" data-id="<?=Yii::$app->urlManager->createUrl(["{$conId}/sure-order",'order_info_id'=>$val['order_info_id']])?>">确认收货</a>
                    
                </div>
            <?php elseif(OrderInfoDetail::$STATUS_ORDER_OK == $val['status']) : ?>
                <?php if ($val['orderGoods']['flg'] == OrderInfoDetail::$STATUS_COMMENT_NO): ?>
                    <div class="bottom">
                        <p><span></span></p>
                        <a class="btn" href="<?=Yii::$app->urlManager->createUrl(["{$conId}/logic",'order_info_id'=>$val['order_info_id']])?>">查看物流</a>
                        <a class="btn shaidan">评论晒单</a>
                      
                    </div>
                <?php endif ;?>
            <?php endif ;?>
        </li>
    <?php endforeach ;?>
<?php endif ;?>